/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package reportcenter.auth.ui;

import javax.swing.JComponent;
import org.springframework.richclient.form.AbstractForm;
import org.springframework.richclient.form.builder.TableFormBuilder;
import reportcenter.auth.dominio.Users;

/**
 *
 * @author renan
 */
public class UserAuthForm extends AbstractForm{
    
    private JComponent nameField;
    
    public UserAuthForm(Users user){
        super(user);
        setId("userAuthForm");
    }

    @Override
    protected JComponent createFormControl() {
        TableFormBuilder formBuilder = new TableFormBuilder(getBindingFactory());

        formBuilder.setLabelAttributes("colGrId=label colSpec=right:pref");

        formBuilder.addSeparator(getMessage("userAuthForm.separator.title1"));
        formBuilder.row();
        nameField = formBuilder.add("username","colSpan=1 align=left")[1];
        formBuilder.row();
        formBuilder.addPasswordField("password","colSpan=1 align=left");
        formBuilder.row();
        formBuilder.add("boolEnabled","colSpan=1 align=left");

        return formBuilder.getForm();
    }
    
    public boolean requestFocusInWindow() {
        return nameField.requestFocusInWindow();
    }

}
